# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-whitenoise
pkgver=6.4.0
pkgrel=2
pkgdesc='Radically simplified static file serving for WSGI applications'
arch=('any')
license=('MIT')
url='https://github.com/evansd/whitenoise'
depends=('python')
makedepends=('python-build' 'python-installer' 'python-setuptools' 'python-wheel')
checkdepends=('python-brotli' 'python-django' 'python-pytest' 'python-requests')
source=("https://github.com/evansd/whitenoise/archive/$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('c3dc7c2d380839913f38f6697ecf0c90fbf8f1bf28cc1b00aaaf9022ac44cd0044015e11435ad640970993b3dab29e94e55f8897c11152f6f6502e66d8b7b726')

build() {
  cd whitenoise-$pkgver
  python -m build -nw
}

check() {
  cd whitenoise-$pkgver
  DJANGO_SETTINGS_MODULE=tests.django_settings PYTHONPATH="$PWD"/src pytest
}

package() {
  cd whitenoise-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}
